package 算法.LeetCode91.每日打卡题目;

import 算法.NiuKe.ListNode;

/**
 * @author: 谢君臣
 * @create: 2021-02-07 19:38
 * @founction: XXXX
 */
public class day08 {
    public static void main(String[] args) {

    }

    public static ListNode swapPairs(ListNode head) {
        ListNode pre = new ListNode(0);
        pre.next = head;
        ListNode temp = pre;
        while(temp.next != null && temp.next.next != null) {
            ListNode start = temp.next;
            ListNode end = temp.next.next;
            temp.next = end;
            start.next = end.next;
            end.next = start;
            temp = start;
        }
        return pre.next;
    }
}
